﻿<!-- BEGIN MAIN CONTENT -->
<div class="row">
    <div class="col-md-12">
        <!-- BEGIN: ACCORDION DEMO -->
        <div class="portlet light">
            <div class="portlet-title page-bar">
                <ul class="page-breadcrumb pull-right">
                    <li>
                        <i class="fa fa-home"></i>
                        <a href="#/home.html">管理中心</a>
                        <i class="fa fa-angle-right"></i>
                    </li>
                    <li>
                        <a href="#/GgcmsArticleList.html">文章内容管理</a>
                        <i class="fa fa-angle-right"></i>
                    </li>
                    <li>
                        <a href="javascript:;" data-ng-bind="$state.current.data.pageTitle"></a>
                    </li>
                </ul>
                <div class="caption font-green-sharp">
                    <i class="icon-note font-green-sharp"></i>
                    <span class="caption-subject bold uppercase" data-ng-bind="$state.current.data.pageTitle"></span>
                </div>
            </div>
            <div class="portlet-body">
                <div class="row">
                    <div class="col-xs-12">
                        <form class="form-horizontal" name="ggcmsForm" role="form" novalidate>
                            <input type="hidden" ng-model="data.Id">
                            <div class="form-body">
                                <uib-tabset active="active">
                                    <uib-tab heading="基本信息">
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.Title.$invalid&&!ggcmsForm.Title.$pristine}">
                                            <label class="col-md-3 control-label">文章标题:</label>
                                            <div class="col-md-9">
                                                <input type="text" name="Title" minlength="2" maxlength="200" class="form-control" placeholder="文章标题" required ng-model="data.Title">
                                                <div class="help-block" ng-show="ggcmsForm.Title.$invalid&&!ggcmsForm.Title.$pristine"> 必须输入文章标题 </div>
                                            </div>
                                        </div>
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.btnSelectLogo.$invalid&&!ggcmsForm.btnSelectLogo.$pristine}">
                                            <label class="col-md-3 control-label">标题图片:</label>
                                            <div class="col-md-9">
                                                <input type="text" class="form-control input-medium inline-block" ng-model="data.TitleImg" name="TitleImg" id="TitleImg" placeholder="可以直接填写Url地址" />
                                                <button class="btn blue" type="button" ngf-select="editSvr.fileUpload($file,'TitleImg',false,0)" ng-model="currentInfo.btnSelectLogo" name="btnSelectLogo" ngf-pattern="'image/*'" ngf-accept="'image/*'" ngf-max-size="200KB"> <i class="icon-picture"></i> 选择图片 </button>
                                                <button class="btn green" type="button" name="btnPreviewLogo" ng-if="data.TitleImg" ng-click="editSvr.filePreview('TitleImg')"> <i class="icon-eye"></i> 预览 </button>
                                                <button class="btn red" type="button" name="btnClearLogo" ng-if="data.TitleImg" ng-click="editSvr.fileClear('TitleImg')"> <i class="icon-trash"></i> 清除 </button>
                                                <div class="help-block" ng-show="ggcmsForm.btnSelectLogo.$invalid&&!ggcmsForm.btnSelectLogo.$pristine"> 只能上传小于200kb的图片 </div>
                                            </div>
                                        </div>
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.RedirectUrl.$invalid&&!ggcmsForm.RedirectUrl.$pristine}">
                                            <label class="col-md-3 control-label">跳转URL</label>
                                            <div class="col-md-9">
                                                <input type="url" name="RedirectUrl" minlength="2" maxlength="30" class="form-control" placeholder="跳转URL" ng-model="data.RedirectUrl">
                                                <div class="help-block" ng-show="ggcmsForm.RedirectUrl.$invalid&&!ggcmsForm.RedirectUrl.$pristine"> url地址格式不正确 </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-md-3 control-label">所属分类:</label>
                                            <div class="col-md-6">
                                                <div class="input-group">
                                                    <span class="form-control" ng-bind="data.CategoryName"></span>
                                                    <div class="input-group-btn">
                                                        <button type="button" class="btn btn-default dropdown-toggle" ng-click="currentInfo.showCategoryTree=!currentInfo.showCategoryTree">
                                                            <i class="fa fa-angle-down"></i>
                                                        </button>
                                                    </div>
                                                    <input type="hidden" name="Category_Id" ng-model="data.Category_Id" pattern="^[^0]$" required>
                                                    <div class="help-block" ng-show="ggcmsForm.Category_Id.$invalid&&!ggcmsForm.Category_Id.$pristine"> 请选择所属分类 </div>
                                                </div>
                                                <treecontrol ng-if="currentInfo.showCategoryTree" class="tree-classic" expanded-nodes="currentInfo.expandedNodes" tree-model="currentInfo.dataForTheTree" options="treeOptions" on-selection="showSelected(node)" selected-node="currentInfo.selectNode">
                                                    [{{node.Id}}] {{node.CategoryName}}
                                                </treecontrol>
                                            </div>
                                        </div>
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.Content.$invalid&&!ggcmsForm.Content.$pristine}">
                                            <label class="col-md-3 control-label">文章内容:</label>
                                            <div class="col-md-9">
                                                <summernote config="editoptions" required id="Content" name="Content" class="form-control" placeholder="文章内容" ng-model="data.Content" on-image-upload="editSvr.imagesUpload(files,'Content')" on-media-delete="editSvr.fileClear(target)"></summernote>
                                                <div class="help-block" ng-show="ggcmsForm.Content.$invalid&&!ggcmsForm.Content.$pristine"> 文章内容不能为空 </div>
                                            </div>
                                        </div>
                                    </uib-tab>
                                    <uib-tab heading="辅助信息">
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.Author.$invalid&&!ggcmsForm.Author.$pristine}">
                                            <label class="col-md-3 control-label">作者:</label>
                                            <div class="col-md-9">
                                                <input type="text" name="Author" minlength="2" maxlength="30" class="form-control" placeholder="作者" ng-model="data.Author">
                                                <div class="help-block" ng-show="ggcmsForm.Author.$invalid&&!ggcmsForm.Author.$pristine"> 作者 </div>
                                            </div>
                                        </div>
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.Source.$invalid&&!ggcmsForm.Source.$pristine}">
                                            <label class="col-md-3 control-label">来源:</label>
                                            <div class="col-md-9">
                                                <input type="text" name="Source" minlength="2" maxlength="30" class="form-control" placeholder="来源" ng-model="data.Source">
                                                <div class="help-block" ng-show="ggcmsForm.Source.$invalid&&!ggcmsForm.Source.$pristine"> 来源 </div>
                                            </div>
                                        </div>
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.SourceUrl.$invalid&&!ggcmsForm.SourceUrl.$pristine}">
                                            <label class="col-md-3 control-label">来源URL:</label>
                                            <div class="col-md-9">
                                                <input type="url" name="SourceUrl" minlength="2" maxlength="30" class="form-control" placeholder="来源URL" ng-model="data.SourceUrl">
                                                <div class="help-block" ng-show="ggcmsForm.SourceUrl.$invalid&&!ggcmsForm.SourceUrl.$pristine"> 来源URL </div>
                                            </div>
                                        </div>
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.Keywords.$invalid&&!ggcmsForm.Keywords.$pristine}">
                                            <label class="col-md-3 control-label">文章关键词:</label>
                                            <div class="col-md-9">
                                                <input type="text" name="Keywords" minlength="2" maxlength="255" class="form-control" placeholder="文章关键词" ng-model="data.Keywords">
                                                <div class="help-block" ng-show="ggcmsForm.Keywords.$invalid&&!ggcmsForm.Keywords.$pristine"> 文章关键词 </div>
                                            </div>
                                        </div>
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.Description.$invalid&&!ggcmsForm.Description.$pristine}">
                                            <label class="col-md-3 control-label">文章摘要:</label>
                                            <div class="col-md-9">
                                                <textarea name="Description" id="Description" maxlength="255" rows="4" class="form-control" placeholder="文章摘要" ng-model="data.Description"></textarea>
                                                <div class="help-block" ng-show="ggcmsForm.Description.$invalid&&!ggcmsForm.Description.$pristine"> 文章摘要 </div>
                                            </div>
                                        </div>
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.Recommendmode.$invalid&&!ggcmsForm.Recommendmode.$pristine}">
                                            <label class="col-md-3 control-label">推荐模式:</label>
                                            <div class="col-md-9">
                                                <select class="form-control" name="Recommendmode" id="Recommendmode" ng-model="data.Recommendmode" ng-options="kv.type as kv.name for kv in sysDicts.Recommendmode"></select>
                                                <div class="help-block" ng-show="ggcmsForm.Recommendmode.$invalid&&!ggcmsForm.Recommendmode.$pristine"> 推荐模式 </div>
                                            </div>
                                        </div>
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.Recommendlevel.$invalid&&!ggcmsForm.Recommendlevel.$pristine}">
                                            <label class="col-md-3 control-label">推荐级别:</label>
                                            <div class="col-md-9">
                                                <select class="form-control" name="Recommendlevel" id="Recommendlevel" ng-model="data.Recommendlevel" ng-options="kv.type as kv.name for kv in sysDicts.Recommendlevel"></select>
                                                <div class="help-block" ng-show="ggcmsForm.Recommendlevel.$invalid&&!ggcmsForm.Recommendlevel.$pristine"> 推荐级别 </div>
                                            </div>
                                        </div>
                                    </uib-tab>
                                    <uib-tab heading="附件">
                                        <div class="clearfix mg-b-20">
                                            <button class="btn green-haze btn-outline sbold uppercase" ng-click="editSvr.attaAdd()"> <i class="fa fa-plus"></i> 添加附件 </button>
                                        </div>
                                        <div class="alert alert-danger"> <i class="fa fa-exclamation-triangle"></i> 为方便展示，请正确选择附件类型。 </div>
                                        <div class="form-group" ng-class="{'has-error' : ggcmsForm.{{item.btnName}}.$invalid&&!ggcmsForm.{{item.btnName}}.$pristine}" ng-repeat="item in data.AttaList| filter:{AttaType:'!-1'} | orderBy:'Sortid'">
                                            <div class="col-sm-2">
                                                <select class="form-control" name="FileType" id="FileType" ng-model="item.FileType" ng-options="kv.type as kv.name for kv in sysDicts.fileType"></select>
                                            </div>
                                            <div class="col-sm-2">
                                                <input type="text" name="atta_{{item.nid}}" id="atta_{{item.nid}}" maxlength="30" class="form-control" placeholder="请填写附件说明" ng-model="item.Info">
                                            </div>
                                            <div class="col-sm-2">
                                                <input type="text" name="attRedirectUrl_{{item.nid}}" id="attRedirectUrl_{{item.nid}}" maxlength="255" class="form-control" placeholder="可以直接填写Url地址" ng-model="item.AttRedirectUrl">
                                            </div>
                                            <div class="col-sm-2">
                                                <div class="clearfix">
                                                    <div class="btn-group btn-group-justified">
                                                        <a href="javascript:;" class="btn blue btn-outline" ng-if="item.Sortid>1" ng-click="editSvr.attrUpDown(item,-1.5)"> <i class="fa fa-angle-double-up"></i> </a>
                                                        <a href="javascript:;" class="btn blue btn-outline" ng-if="item.Sortid<editSvr.attrCount()" ng-click="editSvr.attrUpDown(item,1.5)"> <i class="fa fa-angle-double-down"></i> </a>
                                                        <a href="javascript:;" class="btn red btn-outline" ng-click="editSvr.attrDelete(item)"> <i class="fa fa-times"></i> </a>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="col-sm-4">
                                                <button class="btn blue" type="button" ngf-select="editSvr.fileUpload($file,item,false,0)" ng-model="item.file" name="{{item.btnName}}" ngf-max-size="2MB"> <i class="fa fa-paperclip"></i> 选择文件 </button>
                                                <button class="btn green" type="button" name="{{item.btnName}}Preview" ng-if="item.FileType.indexOf('image')==0" ng-click="editSvr.filePreview(item)"> <i class="icon-eye"></i> 预览 </button>
                                                <button class="btn red" type="button" name="{{item.btnName}}Clear" ng-if="item.AttRedirectUrl" ng-click="editSvr.fileClear(item)"> <i class="icon-trash"></i> 清除 </button>
                                                <div class="help-block" ng-show="ggcmsForm.{{item.btnName}}.$invalid&&!ggcmsForm.{{item.btnName}}.$pristine"> 附件必须小于2M </div>
                                            </div>
                                        </div>
                                    </uib-tab>
                                </uib-tabset>
                            </div>
                            <div class="form-actions">
                                <hr/>
                                <div class="row">
                                    <div class="col-md-12 text-center">
                                        <button class="btn green" ng-click="saveData(data)" ng-disabled="ggcmsForm.$invalid||saveing"> <span class="fa fa-save"></span> 保存</button>
                                    </div>
                                </div>
                            </div>
                        </form>

                    </div>
                </div>
            </div>
        </div>
        <!-- END: ACCORDION DEMO -->
    </div>
</div>
<!-- END MAIN CONTENT -->
<pic-pre-view url="currentInfo.pic" close="editSvr.previewClose()" ng-if="currentInfo.picShow"></pic-pre-view>